<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;
return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('rd_organize_user_apply', function (Blueprint $table) {
            $table->comment('用户权限申请');
            $table->bigIncrements('id')->comment('主键');
            $table->unsignedBigInteger('user_id')->comment('申请人');
            $table->unsignedTinyInteger('area')->comment('申请范围1:项目,2:工区,3:站');
            $table->json('area_ids')->comment('申请范围id');
            $table->unsignedTinyInteger('role')->comment('角色1:管理员,2:安全员');
            $table->unsignedBigInteger('apply_id')->nullable()->comment('审批人id');
            $table->unsignedTinyInteger('status')->default(1)->comment('状态1:待审批,2:通过,3:拒绝');
            $table->string('name', 255)->comment('申请名称');
            $table->json('apply_data')->comment('审批结果数据');
            $table->timestamps();
            $table->string('remark', 255)->comment('备注')->default('');
        });
    }
    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('rd_organize_user_apply');
    }
};